﻿<Window x:Class="LightRestDemos.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    Title="LightRest Demos" Height="400" Width="600" WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ComboBox IsEditable="True"
                SelectedIndex="0"
                x:Name="requestMethod"
                Grid.Column="0">
                <ComboBox.Items>
                    <ComboBoxItem IsSelected="True">GET</ComboBoxItem>
                    <ComboBoxItem>HEAD</ComboBoxItem>
                    <ComboBoxItem>PUT</ComboBoxItem>
                    <ComboBoxItem>POST</ComboBoxItem>
                    <ComboBoxItem>DELETE</ComboBoxItem>
                    <ComboBoxItem>TRACE</ComboBoxItem>
                    <ComboBoxItem>OPTIONS</ComboBoxItem>
                </ComboBox.Items>
            </ComboBox>
            <ComboBox IsEditable="True"
                Padding="5 0 0 0"
                HorizontalAlignment="Stretch"
                x:Name="requestUri"
                Grid.Column="1"
                SelectedIndex="0"
                KeyDown="sendOnEnter" Text="http://owlcity.cn/rest.aspx?at=wpfclient">
                <ComboBox.Items>
                    <s:String>http://owlcity.cn/rest.aspx?at=wpfclient</s:String>
                    <s:String>http://172.21.120.186:8001/rest.aspx?at=wpfclient</s:String>
                    <s:String>http://api.t.sina.com.cn/statuses/public_timeline.xml</s:String>
                    <s:String>http://api.t.sina.com.cn/statuses/public_timeline.json</s:String>
                    <s:String>https://twitter.com/statuses/public_timeline.xml</s:String>
                    <s:String>http://msdn.microsoft.com/wcf/rest/</s:String>
                    <s:String>http://this-host-does-not-exist/</s:String>
                    <s:String>https://connect.microsoft.com/dashboard</s:String>
                    <s:String>http://www.microsoft.jp/</s:String>
                    <s:String>http://www.microsoft.com/feeds/msdn/en-us/rss.xml</s:String>
                </ComboBox.Items>
            </ComboBox>
            <Button Grid.Column="2"
              x:Name="sendButton"
              Click="sendButton_Click">Begein Send</Button>

            <Expander Header="body"
                Grid.Row="3"
                Grid.Column="0"
                Grid.ColumnSpan="4">
                <StackPanel>
                    <WrapPanel>
                        <CheckBox IsChecked="False"
                      Margin="0 0 20 0"
                      VerticalAlignment="Center"
                      x:Name="checkRequestBody">send</CheckBox>
                        <Button IsEnabled="{Binding ElementName=checkRequestBody, Path=IsChecked}"
                    Click="clearRequestBody">clear</Button>
                    </WrapPanel>
                    <TextBox AcceptsReturn="True"
                   xml:space="preserve"
                   x:Name="requestBody"
                   IsEnabled="{Binding ElementName=checkRequestBody, Path=IsChecked}"
                   MinLines="10"></TextBox>
                </StackPanel>

            </Expander>

        </Grid>

        <Canvas Height="20"
            Grid.Row="1" />
        <TabControl x:Name="responsePanel"
                Grid.Row="2"
                IsEnabled="False">
            <TabItem x:Name="responseTab"
               Header="response">
                <DockPanel>
                    <StackPanel DockPanel.Dock="Top">
                        <TextBlock x:Name="responseStatusOrExceptionMessage" />
                        <TextBlock x:Name="responseMethodAndUri" />
                    </StackPanel>
                    <TextBox HorizontalScrollBarVisibility="Auto"
                   VerticalScrollBarVisibility="Auto"
                   MinLines="5"
                   x:Name="responseHeadersOrException" />
                </DockPanel>
            </TabItem>
            <TabItem Header="body" x:Name="responseBodyTab">
                <TextBox HorizontalScrollBarVisibility="Auto"
                 VerticalScrollBarVisibility="Auto"
                 MinLines="5"
                 x:Name="responseBody" />
            </TabItem>
        </TabControl>
    </Grid>
</Window>
